<?php


namespace UU\Suite\Kernel\Traits;


use UU\Suite\Kernel\Config;
use UU\Suite\Kernel\Contracts\ConfigInterface;

trait InteractWithConfig
{
    /**
     * @var ConfigInterface|mixed|Config|null
     */
    protected $config;

    /**
     */
    public function __construct($config = [])
    {
        if (\is_array($config)) {
            $config = new Config($config);
        }
        $this->config = $config;
    }

    public function getConfig(): ConfigInterface
    {
        return $this->config;
    }

    public function setConfig(ConfigInterface $config): self
    {
        $this->config = $config;

        return $this;
    }
}